package it.traveldream.dto;

import it.traveldream.dto.HotelDTO.HotelRoomType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

public class ReservationDTO implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Long reservationId;
	private Date leavingDate;
	private Date endDate;
	private UserDTO customer;
	private int travellers;
	
	private TransportMeanDTO mean;
	private HotelDTO hotel;
	private Map<HotelRoomType, Integer> hotelRooms;
	private List<ExcursionDTO> excursions = new ArrayList<>();

	private BigDecimal totalPrice;
	
	public Long getReservationId() {
		return this.reservationId;
	}
	public void setReservationId(Long reservationId) {
		this.reservationId = reservationId;
	}
	public Date getLeavingDate() {
		return this.leavingDate;
	}
	public void setLeavingDate(Date leavingDate) {
		this.leavingDate = leavingDate;
	}
	public Date getEndDate() {
		return this.endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	public UserDTO getCustomer() {
		return this.customer;
	}
	public void setCustomer(UserDTO customer) {
		this.customer = customer;
	}
	public int getTravellers() {
		return this.travellers;
	}
	public void setTravellers(int travellers) {
		this.travellers = travellers;
	}
	public TransportMeanDTO getMean() {
		return this.mean;
	}
	public void setMean(TransportMeanDTO mean) {
		this.mean = mean;
	}
	public HotelDTO getHotel() {
		return this.hotel;
	}
	public void setHotel(HotelDTO hotel) {
		this.hotel = hotel;
	}
	public Map<HotelRoomType, Integer> getHotelRooms() {
		return this.hotelRooms;
	}
	public void setHotelRooms(Map<HotelRoomType, Integer> hotelRooms) {
		this.hotelRooms = hotelRooms;
	}
	public List<ExcursionDTO> getExcursions() {
		return this.excursions;
	}
	public void setExcursions(List<ExcursionDTO> excursions) {
		this.excursions = excursions;
	}
	
	public BigDecimal getTotalPrice(){
		return new BigDecimal(this.totalPrice.toString());
	}
	
	public void setTotalPrice(BigDecimal totalPrice){
		this.totalPrice = new BigDecimal(totalPrice.toString());
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((this.reservationId == null) ? 0 : this.reservationId
						.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof ReservationDTO))
			return false;
		ReservationDTO other = (ReservationDTO) obj;
		if (this.reservationId == null) {
			if (other.reservationId != null)
				return false;
		} else if (!this.reservationId.equals(other.reservationId))
			return false;
		return true;
	}

}
